home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
cxl400.arc
/
CXLKEY.H
< prev
next >
Wrap
C/C++ Source or Header
|
1988-11-19
|
4KB
|
94 lines
/*
┌──────────────────────────────────────────────────────────────────────────┐
│ │
│ CXLKEY.H - CXL (c) 1987, 1988 by Mike Smedley. │
│ │
│ This header file contains function prototypes and definitions for │
│ keyboard functions. Keyboard functions for windowing functions are │
│ defined in CXLWIN.H │
│ │
└──────────────────────────────────────────────────────────────────────────┘
*/
#if defined(__TURBOC__)
#if __STDC__
#define _Cdecl
#else
#define _Cdecl cdecl
#endif
#define _Near
#elif defined(__ZTC__)
#define _Cdecl
#define _Near
#elif defined(M_I86) && !defined(__ZTC__)
#if !defined(NO_EXT_KEYS)
#define _Cdecl cdecl
#define _Near near
#else
#define _Cdecl
#define _Near
#endif
#endif
/*---------------------------[ Function Prototypes ]-------------------------*/
int _Cdecl getchf(char *valid,int defchar);
int _Cdecl getns(char *str,int max);
unsigned _Cdecl getxch(void);
int _Cdecl inputsf(char *str,char *fmt);
int _Cdecl setonkey(unsigned keycode,void (*func) (void),int pass);
int _Cdecl waitkey(void);
int _Cdecl waitkeyt(int duration);
/*-----------------------[ definition of onkey record ]----------------------*/
struct _onkey_t {
struct _onkey_t *prev; /* pointer to previous record */
struct _onkey_t *next; /* pointer to next record */
unsigned int keycode; /* Scan/ASCII code of trap key */
void (*func) (void); /* address of onkey function */
int pass; /* pass key to caller? 0=no, 1=yes */
};
/* pointer to current onkey record */
extern struct _onkey_t *_Near _Cdecl _onkey;
/* pointer to procedure to call
while waiting for keypress */
extern void (*_Near _Cdecl _kbloop) (void);
/*-------------[ keyboard status codes returned from kbstat() ]--------------*/
#define RSHIFT 1 /* right shift pressed */
#define LSHIFT 2 /* left shift pressed */
#define CTRL 4 /* <Ctrl> pressed */
#define ALT 8 /* <Alt> pressed */
#define SCRLOCK 16 /* <Scroll Lock> toggled */
#define NUMLOCK 32 /* <Num Lock> toggled */
#define CAPSLOCK 64 /* <Caps Lock> toggled */
#define INS 128 /* <Ins> toggled */
/*-----------------------[ macro-function definitions ]-----------------------*/
#if !defined(MK_FP)
#define MK_FP(seg,ofs) ((void far *) (((unsigned long)(seg) << 16) | \
(unsigned)(ofs)))
#endif
#if !defined(poke)
#define poke(a,b,c) (*((int far*)MK_FP((a),(b))) = (int)(c))
#define pokeb(a,b,c) (*((char far*)MK_FP((a),(b))) = (char)(c))
#define peek(a,b) (*((int far*)MK_FP((a),(b))))
#define peekb(a,b) (*((char far*)MK_FP((a),(b))))
#endif
#define capsoff() poke(0,0x417,peek(0,0x417)&191)
#define capson() poke(0,0x417,peek(0,0x417)|64)
#define clearkeys() while(kbhit()) getch()
#define kbstat() peek(0,0x417)
#define numoff() poke(0,0x417,peek(0,0x417)&223)
#define numon() poke(0,0x417,peek(0,0x417)|32)
#define setkbloop(a) (_kbloop=a)